<?php
	include_once $_SERVER["DOCUMENT_ROOT"]."/outils/string/StringUtils.php";
	include_once $_SERVER["DOCUMENT_ROOT"]."/web/albumphoto/GererAlbumPhotoAction.php";
	include_once($_SERVER["DOCUMENT_ROOT"]."/outils/properties/PropertiesLoader.php");
?>

<link rel="stylesheet" type="text/css" href="/css/photo/photo.css" />

<?php
	$idAlbumPhoto = $_GET['idAlbumPhoto'];
	$nomPhoto = $_GET['nomPhotoParDefaut'];
?>
	<img class="photo_visionneuse" id='photoVisionneuse' style='position:absolute;'/>

<div id="bandeMiniatures" class='bande_miniature_fond' style='position:absolute; overflow:auto; width: 100%; height: 130px; left:0px; right:0px; background-color: CCCCCC;' >
	<center>
		<table >
		<tr>
		<?php 
			PropertiesLoader::loadProperties($_SERVER["DOCUMENT_ROOT"].'/properties.ini');
			$cheminAlbumPhoto = PropertiesLoader::getProperty("albumPhoto.chemin", true);
			$cheminListePhotoAvecRoot = $_SERVER["DOCUMENT_ROOT"].$cheminAlbumPhoto."/".$idAlbumPhoto;
			$nomCompletPhotoParDefaut = $cheminAlbumPhoto."/".$idAlbumPhoto."/".$nomPhoto;
			
			if (is_dir($cheminListePhotoAvecRoot)) {
				$listeMiniature = GererAlbumPhotoAction::getListeMiniatureFromAlbumId($idAlbumPhoto);
				foreach($listeMiniature as $miniature) {
					$nomCompletMiniature = $miniature->nomCompletMiniature;
					$nomCompletPhoto = $miniature->cheminPhotoOrigine."/".$miniature->nomPhoto;
					?>
						<td>
							<a href="javascript:chargerImage('<?php echo$nomCompletPhoto?>');">
								<img src="<?php echo $nomCompletMiniature;?>" class="cadre_miniature"/>
							</a>
						</td>
					<?php
				}
				if ($nomCompletPhotoParDefaut != "") {
					echo "<script language='javascript'> chargerImage('$nomCompletPhotoParDefaut') </script>";
				}
			}
		?>
		</tr>
		</table>
	</center>
</div>